#!/bin/sh

set -x
touch /root/serf.debug
read input_content
echo $input_content > /root/serf.debug
FILENAME=$(echo "$input_content" | cut -d ',' -f1)
CID=$(echo "$input_content" | cut -d ',' -f2)
echo $FILENAME >> /root/serf.debug
echo $CID >> /root/serf.debug
NODE_IP=127.0.0.1
EAGLE_PORT=9090
URL="http://$NODE_IP:$EAGLE_PORT/v1/file/sendToPeers"
DATA="{\"path\": \"$FILENAME\", \"cid\": \"$CID\"}"
echo $USL >> /root/serf.debug
echo $DATA >> /root/serf.debug
echo $NODE_IP >> /root/serf.debug
echo $EAGLE_PORT >> /root/serf.debug
curl -s -H'Content-Type:application/json' ${URL} -d"$DATA"